package com.project.config;



import com.project.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;

import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    public void addResourceHandlers(ResourceHandlerRegistry registry){
        registry.addResourceHandler("/emFace/**")
                .addResourceLocations("file:D:\\javabase\\web\\car\\src\\main\\resources\\static\\img/");
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())//注册拦截器
                .addPathPatterns("/post/add")
                .addPathPatterns("/reply/add");//定义拦截器范围

    }

}
